home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / splash_screen.gl.p < prev    next >
Text File  |  2003-04-14  |  6KB  |  184 lines

  1. {
  2.   ActiveWhileHidden = TRUE;
  3.  
  4.   ScriptID = script {
  5.  
  6.       @loaded {
  7.         resid main_menu;      
  8.                  
  9.         /* show more_info and buy_it buttons if this is a demo */
  10.         if (CVarGetInt("demo") == 1) {
  11.           ResPropSetInt(GuiChildByName(SELF,"buy_it"),"Hidden",FALSE);
  12.           ResPropSetInt(GuiChildByName(SELF,"more_info"),"Hidden",FALSE);          
  13.         }
  14.         
  15.         
  16.         /* pre load all of the menus */
  17.         main_menu = ResByName("main_menu.gl");
  18.         ResByName("game_setup.gl");
  19.         ResByName("game_options.gl");
  20.         ResByName("credits.gl");
  21.       ResByName("load_saved_game.gl");
  22.       ResByName("load_scenario.gl");
  23.     }
  24.   };
  25.  
  26.   ChildID = {
  27.     GuiMenuController("menu_controller") {
  28.       ScriptID = script {
  29.         @loaded {
  30.           ResPropSetInt(SELF,"state",-1);
  31.         }
  32.         @animate {
  33.           resid panel_to_display;
  34.           resid panel_being_displayed;
  35.           resid sound;
  36.           resid reverse_sound;
  37.           int panel_to_display_x;
  38.           int panel_to_display_y;
  39.           int panel_being_displayed_x;
  40.           int panel_being_displayed_y;
  41.           int panel_to_display_width;
  42.           int panel_being_displayed_width;
  43.           int speed;
  44.           int state;
  45.           int timeout;
  46.                     
  47.           /*
  48.            -2 = startup wait
  49.            -1 = startup
  50.            0  = stop
  51.            1  = to hide
  52.            2  = to show
  53.           */
  54.  
  55.           
  56.           speed = 65;
  57.           sound = ResByName("sound/menu_swipe.wav");
  58.           reverse_sound = ResByName("sound/menu_swipe_reverse.wav");
  59.           ResPropAlias(SELF, "panel_to_display", "panel_to_display");
  60.           ResPropAlias(SELF, "panel_being_displayed", "panel_being_displayed");
  61.           ResPropAlias(panel_being_displayed,"X","panel_being_displayed_x");
  62.           ResPropAlias(panel_being_displayed,"Y","panel_being_displayed_y");
  63.           ResPropAlias(panel_to_display,"X","panel_to_display_x");
  64.           ResPropAlias(panel_to_display,"Y","panel_to_display_y");            
  65.           ResPropAlias(panel_to_display,"Width","panel_to_display_width"); 
  66.           ResPropAlias(panel_being_displayed,"Width","panel_being_displayed_width");
  67.           ResPropAlias(SELF,"state","state");   
  68.           ResPropAlias(SELF,"timeout","timeout");   
  69.  
  70.           if (state==-1) {
  71.             
  72.             if (CVarGetInt("horn_played") != 1) {
  73.               AudioPlay(ResByName("sound/horn.wav"));
  74.               CVarSetInt("horn_played",1);
  75.             }
  76.             timeout = CVarGetInt("framerate")*1;
  77.             state = -2;
  78.             stop;
  79.           }
  80.  
  81.           if (state==-2) {
  82.             if (timeout<=0) { 
  83.               panel_to_display = ResByName("main_menu.gl");
  84.               ResPropSetInt(panel_to_display, "X", (-ResPropGetInt(panel_to_display, "Width")) - 20);
  85.               ResPropSetInt(panel_to_display, "Y", 20);
  86.               ResPropSetInt(panel_to_display, "Hidden", FALSE);
  87.               state=2;
  88.               stop;
  89.             }
  90.             timeout -= 1;
  91.             stop;
  92.           }
  93.  
  94.           if (panel_to_display != panel_being_displayed) {
  95.         
  96.             /* set the state to pan left and put the one being displayed off screen*/
  97.             if (state == 0) {
  98.               AudioPlay( sound );
  99.               panel_to_display_x = (panel_to_display_width * -1) - 200;
  100.               panel_to_display_y = 20;
  101.               state = 1;
  102.             }
  103.  
  104.             if (state == 1) {
  105.               if ((panel_being_displayed_x + panel_being_displayed_width) < 0) {
  106.                 AudioPlay( reverse_sound );
  107.                 state = 2;
  108.                 ResPropSetInt(panel_being_displayed, "Hidden", TRUE);
  109.                 ResPropSetInt(panel_to_display, "Hidden", FALSE);
  110.                 stop;
  111.               } else {
  112.                 panel_being_displayed_x = panel_being_displayed_x - speed;
  113.               }
  114.             }
  115.             
  116.             if (state == 2) {
  117.               if (panel_to_display_x < 20) {
  118.                 if ((panel_to_display_x + speed) > 20 ) {
  119.                   panel_to_display_x = 20;
  120.                 } else {
  121.                   panel_to_display_x = panel_to_display_x + speed;
  122.                 }
  123.               } else {
  124.                 panel_being_displayed = panel_to_display;
  125.                 state = 0;
  126.               }
  127.             }
  128.           }
  129.         }
  130.       }
  131.     },
  132.  
  133.     
  134.     
  135.     GuiAnimation("background") {
  136.       AnimationID = "image/splash.jpg";
  137.       X = 0;
  138.       Y = 0;
  139.       ScriptID = Script {
  140.         @loaded {
  141.           CVarSetStr("dataversion", CSVGetStr(ResPropGetResID(ResByName("CSVData"), "version_id"), "data_version", 0));
  142.         }
  143.         @draw {
  144.           int ver;
  145.           ver = Version();
  146.           DrawTextStr(ResByName("font/arial_12.tf"), 12, 468, "Atlas Version: %d.%d  Data Version: %s", ver / 256, ver % 256, CVarGetStr("dataversion"));
  147.         }
  148.       }
  149.     },
  150.  
  151.  
  152.         GuiButton("more_info") {
  153.       X = 446;
  154.       Y = 284;
  155.       Hidden = TRUE;      
  156.       UpID = "gui/main_menu/demo/more_info_up.jpg";
  157.       HilightedID = "gui/main_menu/demo/more_info_over.jpg";
  158.       ScriptID = Script {
  159.         @activate { 
  160.           if (! BrowserOpenURL(CVarGetStr("demo_information_link"))) {
  161.             LogStr(LOG_DEBUG,"OPEN BROWSER FAILED:%s\n",CVarGetStr("demo_information_link"));
  162.           }
  163.         }
  164.       }
  165.     },
  166.         GuiButton("buy_it") {
  167.       X = 446;
  168.       Y = 320;
  169.       Hidden = TRUE;
  170.       UpID = "gui/main_menu/demo/buy_it_up.jpg";
  171.       HilightedID = "gui/main_menu/demo/buy_it_over.jpg";
  172.       ScriptID = Script {
  173.         @activate { 
  174.           if (! BrowserOpenURL(CVarGetStr("demo_purchase_link"))) {
  175.             LogStr(LOG_DEBUG,"OPEN BROWSER FAILED:%s\n",CVarGetStr("demo_purchase_link"));
  176.           }
  177.         }
  178.       }
  179.     };       
  180.              
  181.       
  182.   };  /* end of layer */
  183. }
  184.